﻿#define _CRT_SECURE_NO_WARNINGS 1 // use for depreate the warning error of scanf

#include <stdio.h>

#define length 10

void ArrPrint(int a[length])
{
	for (int i = 0; i < length; i++)
	{
		printf("%d ", a[i]);
	}
	printf("\n");
}

void main()
{
	//	冒泡排序，从小到大排列
	int tmp, a[length] = { 751,6,33,59,30, 23,45,89,12,34 };
	ArrPrint(a);
	for (int i = 0; i < length; i++)
	{
		for (int j = 0; j < length - 1; j++)
		{
			if (a[j] > a[j + 1])
			{
				//交换
				tmp = a[j];
				a[j] = a[j + 1];
				a[j + 1] = tmp;
			}
		}
	}
	ArrPrint(a);
}
